<?php

class tumblr_scraper extends BlogScraper
{

    function getPostLinks()
    {
        $posts = $this->xpath->query("//html//body//div[@class='post']/a");

        return $posts;
        
    }
 
     
}

class tumblr_post_scraper extends PostScraper
{

    
    function getTitle()
    {
           
        $title = trim($this->xpath->query("//div[@class='post']//div[@class='caption']")->item(0)->nodeValue);
        
        return $title;
        
    }

    function getObjects()
    {

       
  
                $embed = $this->xpath->query("//div[@class='post']//script")->item(1)->nodeValue;
                $embed_parts = explode(',', $embed);
                $attributes = explode("=", $embed_parts[1]);
                list($src, $junk) = explode('&', $attributes[4]);
                echo $src;
                $src .= '?plead=please-dont-download-this-or-our-lawyers-wont-let-us-host-audio';
                
                $embed = array();
                $embed['type'] = "unknown";
                $embed['src'] = $src;
                $embed['name'] = $this->removeQuotes($this->xpath->query("//html//body//div[@class='caption']")->item(0)->nodeValue);
                
    
            
            return array($embed);
        
    }
    
    function processEmbed($embed)
    {
        
        if ($this->processLink($embed['src'], $embed['name'], $this->date, $embed['post_id'], true));
    }
    
    function getDate($post)
    {

        $date = $this->xpath->query("//html//body//div[@class='date']")->item(0)->nodeValue;
        $this->date = date('Y-m-d', strtotime($date));
        


        return $this->date;

    }

}

class dreamsinneon_post_scraper extends tumblr_post_scraper
{
    function prepareTrack($track)
    {
        list($name, $junk) = explode('photo', $track['name']);
        $track['name'] = trim($name);
        
        list($song, $junk) = explode('photo', $track['song']);
        $track['song'] = trim($song);   
          
        return $track;   
    }    
}

class dreamsinneon_scraper extends tumblr_scraper
{
    function __construct()
    {
        parent::__construct('dreamsinneon');
    }
    
}


?>